package com.twd.allcomponent.kafka;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

//@RestController
public class KafkaProducer {
    @Resource
    private KafkaTemplate<String, Object> kafkaTemplate;

    @GetMapping("/kafka/test/{msg}")
    public void sendMessage(@PathVariable("msg") String msg) {
//        Message message = new Message();
//        message.setMessage(msg);
//        kafkaTemplate.send("twd", 0,"",msg);
        kafkaTemplate.send("twd", 1,"","msg");
        kafkaTemplate.send("twd", 2,"","666666");

    }
}
